﻿using System;
using System.Windows;
using System.Windows.Data;

namespace AEM.Converters
{
    [ValueConversion(typeof(string), typeof(string))]
    public class FaultTypeToStringConverter : IValueConverter
    {
        public static FaultTypeToStringConverter Instance = new FaultTypeToStringConverter();

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Data.Enum.LiftStatus s = Data.Enum.LiftStatus.Normal;
            if (null != value)
            {
                try
                {
                    s = (Data.Enum.LiftStatus)(int)value;
                }
                catch
                { }
            }
            return (string)Application.Current.TryFindResource(s.ToString());
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

    }
}
